#ifndef SEQUENCESET_H 
#define SEQUENCESET_H

#include <iostream>
#include <string>
#include <vector>
#include "Page.h"
#include "Key.h"

#define S_OK 0
#define S_ERROR -1
#define S_NO_EXISTE -2
#define S_UNDERFLOW -3
#define S_OVERFLOW -4
#define S_POSICION_INVALIDA -5

class SequenceSet : public Page
{
	protected:
		std::string filename;
		int next;
		int offset;
		std::vector<Key> keys;

		unsigned int computeSize();
		
	public:
		SequenceSet();
		SequenceSet(const SequenceSet & toCopy);
		virtual ~SequenceSet();

		void setFilename(std::string name);
		void getFilename(std::string &name);
		void setOffset(int cur);
		int getOffset();
		void setNext(int next);
		int getNext();
		unsigned int getLevel();

		int add(Key *key);
		int update(Key *key);
		int remove(Key *key);

		int get(Key *key);
		int get(unsigned int pos, Key *key);

		bool findLastKey(Key* key, unsigned int &pos);
		bool findFirstKey(Key* key, unsigned int &pos);

		unsigned int getCount();

		void split(Key* newKey, Key* promo, int &nrrPromo);

		void load();
		void save();

		void print();


		const SequenceSet &operator=(const SequenceSet &toAssign);

};

#endif

